'''
Created on 2013-6-14

@author: gubin
'''
from comm.Logger import Logger
import unittest

class LoggerTestCase(unittest.TestCase):

    def setUp(self):
        self.logger = Logger()


    def tearDown(self):
        self.logger = None

    def testSetLogLevel(self):
        self.logger.SetLogLevel("critical")
        self.assertEqual(self.logger.GetLogLevel(), "critical")
        
    def testLogLevelHigerThanSetting(self):
        self.logger.SetLogLevel("error")
        self.assertEqual(True, self.logger.IsNeedToLogging("critical"))
        
    def testLogLevelLowerThanSetting(self):
        self.logger.SetLogLevel("error")
        self.assertEqual(False, self.logger.IsNeedToLogging("info"))

def suite():  
    suite = unittest.TestSuite()  
    suite.addTest(LoggerTestCase("testSetLogLevel"))
    suite.addTest(LoggerTestCase("testLogLevelHigerThanSetting"))
    suite.addTest(LoggerTestCase("testLogLevelLowerThanSetting"))
    return suite 

if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main(defaultTest = 'suite')